Gave the gnu ports a CMake build, which most of them lacked - #607
Merged
Conversation
The project guidelines ask for CMake and Ninja, but only 15 of the 59 gnu port directories had a CMakeLists.txt. None of the 27 AArch64 ports had one, so the architecture whose examples were repaired over the last few changes still could not be built the way the project says to build it, and nothing in CI could compile it. Add a CMakeLists.txt to the 44 that lacked one. Three of them are templates in ports_arch, because 34 of the 44 are generated: the ARMv7-A and AArch64 source lists are uniform within each family, so one template per family serves every core in it and update.sh distributes it. The other 10 ports have no generator and get their own file. Add the toolchain files those ports select, following the shape of cmake/cortex_a9.cmake. AArch64 needs a base file of its own rather than a variant of arm-none-eabi.cmake: it has no -marm or -mthumb to choose between and no -mfloat-abi, and aarch64-none-elf-gcc rejects -mlong-calls outright, so that flag cannot be carried across. The tools are named without a path, unlike cmake/cortex_r52.cmake which pins one, because pinning 30 files to a single machine's directory layout is the problem the previous change removed from the launch configurations. Three toolchain files cover ports that already had a CMakeLists.txt but no way to select it: the Armv8-M mainline gnu ports, cortex_m33, cortex_m55 and cortex_m85. Without cmake/<arch>.cmake the documented invocation cannot reach them. The top level needed one fix. It derives the SMP port directory as <arch>_smp, but ports_smp/linux and ports_smp/win64 predate that convention and carry no suffix, so those two could never be configured. Fall back to the bare name when the suffixed directory is absent. The check only fires when the suffixed directory does not exist, so no port that already resolved changes behaviour, and ports_smp/win64's existing CMakeLists.txt becomes reachable too. Verified by configuring and building every one: 53 of 53 static libraries build with cmake -G Ninja, using Arm GNU Toolchain 14.3.Rel1 for both arm-none-eabi and aarch64-none-elf. That covers the 44 new ports plus the 9 that already worked, and includes ports_smp/linux, which failed before the fallback. scripts/check_ports.sh passes, so the three templates and their 34 generated copies agree. Six gnu ports are still outside the CMake build, all for want of a compiler rather than a CMakeLists.txt: rxv1, rxv2 and rxv3 need the Renesas RX GNU toolchain and mips32_interaptiv_smp needs a MIPS one, neither of which is available here, so writing toolchain files for them would mean shipping untested guesses. risc-v32 and risc-v64 already build through their own differently named toolchain files. Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The project guidelines ask for CMake and Ninja, but only 15 of the 59 gnu port
directories had a
CMakeLists.txt. None of the 27 AArch64 ports had one, so thearchitecture whose examples were repaired over #597, #599 and #602 still could not
be built the way the project says to build it, and nothing in CI could compile it.
Change
44 new
CMakeLists.txt. Three of them are templates inports_arch, because34 of the 44 are generated. The ARMv7-A and AArch64 source lists are uniform
within each family — checked across every core — so one template per family serves
all of them and
update.shdistributes it:ports_arch/ARMv7-A/threadx/ports/gnuports_arch/ARMv8-A/threadx/ports/gnuports_arch/ARMv8-A/threadx_smp/ports/gnuThe other 10 ports have no generator and get their own file.
30 new toolchain files, following the shape of
cmake/cortex_a9.cmake.AArch64 needs a base file of its own rather than a variant of
arm-none-eabi.cmake: it has no-marm/-mthumbto choose between and no-mfloat-abi, andaarch64-none-elf-gccrejects-mlong-callsoutright, so thatflag cannot simply be carried across.
The tools are named without a path, unlike
cmake/cortex_r52.cmake, which pinsone. Pinning 30 files to a single machine's directory layout is exactly what #603
removed from the launch configurations, so the majority convention wins here;
override
CMAKE_C_COMPILERfor a toolchain that is not onPATH.Three of those files cover ports that already had a
CMakeLists.txtbut no wayto select it — the Armv8-M mainline gnu ports
cortex_m33,cortex_m55andcortex_m85. Without acmake/<arch>.cmake, the documented invocation cannotreach them.
One top-level fix.
CMakeLists.txtderives the SMP port directory as<arch>_smp, butports_smp/linuxandports_smp/win64predate that conventionand carry no suffix, so neither could ever be configured:
The fallback only fires when the suffixed directory is absent, so no port that
already resolved changes behaviour, and
ports_smp/win64's existingCMakeLists.txtbecomes reachable as a side effect.Verification
Every port was configured and built, not merely written.
53 of 53 static libraries build with
cmake -G Ninja, using Arm GNU Toolchain14.3.Rel1 for both
arm-none-eabiandaarch64-none-elf. That is the 44 newports plus the 9 that already worked, and it includes
ports_smp/linux, whichfailed before the fallback and now produces a library. Sizes land where you would
expect: ARMv7-A around 267–270 KB, AArch64 ThreadX around 333 KB, AArch64 SMP
around 400 KB.
scripts/check_ports.shpasses, so the three templates and their 34 generatedcopies agree.
scripts/check_clang.shpasses unchanged — 42 of 42 script-driven examples and5 of 5 Cortex-R52 CMake images. That last one matters, because the R52 CMake
stage runs through the top-level file this change edits.
All three were re-run after rebasing onto #606, with identical results.
Still outside the CMake build
Six gnu ports, every one for want of a compiler rather than a
CMakeLists.txt:rxv1,rxv2,rxv3need the Renesas RX GNU toolchain, andmips32_interaptiv_smpneeds a MIPS one. Neither is available here, and writingtoolchain files for them would mean shipping untested guesses.
risc-v32andrisc-v64already build, through their own differently namedtoolchain files.
Suggested follow-up
Nothing in CI builds any of this yet, which is how the AArch64 ports came to sit
two releases behind in the first place. A workflow running the 53
configure-and-build steps would need the
aarch64-none-elftoolchain downloadedand cached alongside the existing
arm-none-eabione, in the mannerclang_check.ymlalready caches ATfE.